tests: Add basic tests for ostree-prepare-root
authorWilliam Manley <will@williammanley.net>
Wed, 27 Jul 2016 15:40:05 +0000 (16:40 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 2 Aug 2016 19:07:25 +0000 (19:07 +0000)
commit94e50ca5aa19b5a2a8590b317c57412d8862ca9d
tree92fd832c3083d72e0b55d51050409fe33da04a42
parent24671f7d253b08265a8aaaa9c06c0fe517eb20ff
tests: Add basic tests for ostree-prepare-root

These tests use unshare and mount to prepare a fake initrd/early boot
directory structure so we can then test ostree-prepare-root.

Things that are tested:

* Running in an initrd environment
* Running without initrd
* /var and /sysroot being mounted correctly
* /usr being mounted read-only

Things not tested (yet):

* Running as init - this could be accomplished by unsharing the pid
  namespace too.
* mounting/unmounting `/proc` if `/proc/cmdline` isn't available
* Persistent overlayfs for `/usr`
* Probably other things

The tests are basic but can be extended in the future as we do more work
on `ostree-prepare-root`.

These tests must be run as root as they require the ability to `mount`
and to `unshare` the mount namespace. Perhaps in the future we can use
user namespaces for this test once they are more widely available.

Closes: #403
Approved by: cgwalters
Makefile-tests.am
tests/libtest.sh
tests/test-switchroot.sh [new file with mode: 0755]